﻿using MediatR;
using T.Settlement.API.Application.Command.InvoiceCommand;
using T.Settlement.Repository.SettlementInterface;

namespace T.Settlement.API.Application.CommandHandlers.InvoiceHandler
{
    public class InvoiceDelCommandHandler : IRequestHandler<InvoiceDelCommand, int>
    {
        private readonly IInvoiceSRepository _invoiceSRepository;
        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="invoiceSRepository"></param>
        public InvoiceDelCommandHandler(IInvoiceSRepository invoiceSRepository)
        {
            _invoiceSRepository = invoiceSRepository;
        }
        public async Task<int> Handle(InvoiceDelCommand request, CancellationToken cancellationToken)
        {
            request.IsDeleted = true;
            return await _invoiceSRepository.Update(request);
        }
    }
}
